/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wudtcalc.gaskets;

import java.io.Serializable;
import wudtcalc.DataContainer;

/**
 *
 * @author jzajaczek
 */
public class GasketForce implements Serializable {
    private double b;
    private double sigr;
    private double s;
    private double p;
    private double nr;
    private double nm1;
    private double c;
    private double nm2;
    private double n;
    
    DataContainer dc;
    Gasket g;
        
    public GasketForce(){};
    
    public GasketForce(Gasket g_) {
        g = g_;
    };
    
    /**
     * @return the n
     */
    public double getN() {
        return Math.max(getNr(), (Math.max(getNm1(), getNm2())));
    }

    /**
     * @return the nm2
     */
    public double getNm2() {
        return getNm1() * getC();
    }

    /**
     * @return the c
     */
    public double getC() {
        if (g.getDu() < 500.0) {
            return 1.2;
        } else {
            return 1.5;
        } 
    }

    /**
     * @return the nm1
     */
    public double getNm1() {
        return Math.PI * g.getDu() * g.getDu() * g.dc.getSigma_m() * g.dc.getPo();
    }

    /**
     * @return the nr
     */
    public double getNr() {
        return getP() + getB() * getS();
    }

    /**
     * @return the s
     */
    public double getS() {
        return Math.PI * g.getDu() * g.getUcz() * getSigr();
    }

    /**
     * @return the p
     */
    public double getP() {
        return 0.25 * Math.PI * g.getDu() * g.getDu() * g.dc.getPo();
    }

    /**
     * @return the sigr
     */
    public double getSigr() {
        return g.dc.getSigma_r() * g.dc.getPo();
    }

    /**
     * @return the b
     */
    public double getB() {
        double t1, t2, b1, b2;
        double to = g.dc.getTo();
        double b_[] = g.dc.getB();
        for (int i = 0; i < b_.length; i++) {
            t1 = b_[i];
            if (to <= t1) {
            }
        }
        return 1;
    }
}